package org.activequant.store;

import java.io.Serializable;

/**
 * Store service: component can use it to persist its state.
 * <p>
 * An interface. Defines the following methods:
 * <ul>
 * <li>void save(String name, Serializable object) throws Exception;</li>
 * <li>Serializable load(String name) throws Exception;</li>
 * </ul>
 * <b>History:</b><br>
 *  - [03.01.2008] Created (Mike Kroutikov)<br>
 *
 *  @author Mike Kroutikov
 */
public interface IStoreService {
	
	/**
	 * Saves object.
	 * 
	 * @param name name of the persistent object.
	 * @param object object to be saved. If null, then the named persistent 
	 *                      object is deleted (if it exists).
	 * @throws Exception if something goes wrong.
	 */
	void save(String name, Serializable object) throws Exception;
	
	/**
	 * Loads object.
	 * 
	 * @param name name of the persistent object.
	 * @return persistent object, or null if object does not exist.
	 * @throws Exception if something goes wrong.
	 */
	Serializable load(String name) throws Exception;
}
